<template>
	<view style="padding: 30rpx;">
		<u-form-item :label-position="labelPosition" label="原密码" prop="password">
			<u-input :password-icon="true" :border="border" type="password" v-model="rawPassword" placeholder="请输入原来的密码"></u-input>
		</u-form-item>
		<u-form-item :label-position="labelPosition" label="密码" prop="password">
			<u-input :password-icon="true" :border="border" type="password" v-model="password" placeholder="请输入密码"></u-input>
		</u-form-item>
		<u-form-item :label-position="labelPosition" label="确认密码" label-width="150" prop="rePassword">
			<u-input :border="border" type="password" v-model="rePassword" placeholder="请确认密码"></u-input>
		</u-form-item>
		<view class="l-body-fixed">
			<u-button type="primary" size="medium"  style="display: flex; align-items: center; justify-content: center;" @click="changerPwd()">修改</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				labelPosition:'top',
				border:false,
				rawPassword:'',
				password:'',
				rePassword:''
			}
		},
		methods: {
			changerPwd(){
				if(this.rawPassword == ''){
					uni.showToast({
						title:'请输入原密码',
						icon:'none'
					});
					return;
				}
				
				if(this.password == ''){
					uni.showToast({
						title:'请输入密码',
						icon:'none'
					});
					return;
				}
					
				if(this.rePassword == ''){
					uni.showToast({
						title:'请确认密码',
						icon:'none'
					});
					return;
				}
				
				if(this.rePassword != this.password){
					uni.showToast({
						title:'两次密码输入不一致',
						icon:'none'
					});
					return;
				}
				
				// 修改密码
				console.debug('原密码：'+this.rawPassword+'，新密码：'+this.password);
			}
		}
	}
</script>

<style>
page{
	background-color: #FFFFFF;
}
.l-body-fixed {
		position:fixed;
		left: 0upx;
		bottom:0upx;
		z-index: 95;
		display: flex;
		justify-content: space-around;
		align-items: center;
		width: 100%;
		height: 100upx;
		padding: 0 var(--pad-lr);
		background-color: #f7f7fa;
	}
</style>
